<?php
echo  'dirname(__FILE__):'.dirname(__FILE__);
echo '<br />$_SERVER["DOCUMENT_ROOT"]:'.$_SERVER["DOCUMENT_ROOT"];
echo '<br />strlen($_SERVER["DOCUMENT_ROOT"]'.strlen($_SERVER["DOCUMENT_ROOT"]);
echo rtrim(substr(dirname('/'.str_replace('\\', '/', dirname(__FILE__))), strlen($_SERVER["DOCUMENT_ROOT"])), '/\\');
                              str_replace("\\","/",dirname(__FILE__).'/'));
echo '<br />';